package com.zretc.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zretc.entity.Users;
import com.zretc.service.UsersService;

@RestController
public class UsersRestController {

	// 控制器要调用的是service
	@Autowired
	private UsersService us;

	@GetMapping(value = "users", produces = "application/json;charset=utf-8")
	public String getUsersById(int userid) {
		Users user = us.getUserById(userid);

		if (user == null) {
			return "无相关记录";
		}
		return user.toString();
	}

}
